import $http from '@/common/api/request'

// 微信小程序微信登录
export function wxMpTokenDecrypt(data) {
  data.loginType = 'mp'
  return $http.post('/auth/login/v2/wx/mp/token/decrypt', data, {
    noCheck: true
  })
}

// 查询是否需要设置密码
export function isNeedSetPassword() {
  return $http.get('/user/user/v2/updatePassword/notice')
}

// 获取菜单权限
export function getMenu() {
  return $http.get('/user/menu/userMenu')
}

// APP微信绑定手机号
export function bindWechat(data) {
  return $http.post('/auth/login/v2/wx/app/bind', data, {
    noCheck: true
  })
}

// 注册
export function registerV2(data) {
  return $http.post('/auth/login/v2/register', data, { noCheck: true })
}

// 设置密码
export function updatePasswordV2(data) {
  return $http.post('/auth/user/v2/updatePassword', data, {
    noCheck: true
  })
}

// 根据userid注销
export function withdrawCancelByUserId(data) {
  return $http.post('/user/user/withdrawCancelByUserId', data, {
    noCheck: true
  })
}

// 修改手机号，验证旧手机号验证码
export function checkOldPhone(data) {
  return $http.post('/user/user/updateAccountPhone/checkOldPhone', data)
}

// 修改手机号，验证新手机号验证码
export function updateNewPhone(data) {
  return $http.post('/user/user/updateAccountPhone/updateNewPhone', data)
}

// 车企注销
export function autoCompanyWithdraw(data) {
  return $http.post('/user/user/autoCompanyWithdraw', data)
}

// 提交车企认证
export function submitAutoCompanyCert(data) {
  return $http.post('/user/cert/autoCompanyCert', data)
}

// 添加车企主体
export function addAutoCompanyUser(data) {
  return $http.post('/user/user/v2/addAutoCompanyUser', data, {
    header: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// app一键登录
export function appLogin(data) {
  return $http.post('/auth/login/v2/dCloud/token', data, {
    noCheck: true
  })
}
